package book;

/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-23
 * Time: 21:08
 */
//图书 book 实体类
public class Book {
    //创建字段
    private String name;    //书名
    private String author;  //作者
    private String price;   //价格
    private String type;    //图书类型
    private boolean isBorrowed; //是否借出

    //构造方法，是否借出不需要初始化，默认未借出
    public Book(String name, String author, String price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    //常规 get/set 方法
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getPrice() {
        return price;
    }
    public void setPrice(String price) {
        this.price = price;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public boolean isBorrowed() {
        return isBorrowed;
    }
    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    //字段输出打印
    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", price='" + price + '\'' +
                ", type='" + type + '\'' +
                ", isBorrowed=" + isBorrowed +
                '}';
    }
}
